package com.ctgu.examonline.service.serviceImpl;

import com.alibaba.fastjson.JSON;
import com.ctgu.examonline.dao.StudentDao;
import com.ctgu.examonline.entity.QueryInfo;
import com.ctgu.examonline.entity.Student;
import com.ctgu.examonline.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;

    @Override
    public void save(Student student) {
        studentDao.save(student);
    }

    @Override
    public Student login(Integer stu_no, String stu_pwd) {
        return studentDao.findByNoAndPassword(stu_no, stu_pwd);
    }

    @Override
    public List<Student> selectAllStudent() {
        return studentDao.selectAllStudent();
    }

    @Override
    public List<Student> getAllStudent(String stu_name, Integer pageStart, Integer pageSize) {
        return studentDao.getAllStudent(stu_name,pageStart,pageSize);
    }

    @Override
    public Integer getStudentCounts(String stu_name) {
        return studentDao.getStudentCounts(stu_name);
    }
}
